using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;

namespace BUS
{
    public class tbtinhthanhBUS
    {
        public static void Insert(tbtinhthanhDTO tt)
        {
            tbtinhthanhDAL tbtinhthanhDAL = new tbtinhthanhDAL();
            tbtinhthanhDAL.Insert(tt);
        }
        public static void Update(tbtinhthanhDTO tt)
        {
            tbtinhthanhDAL tbtinhthanhDAL = new tbtinhthanhDAL();
            tbtinhthanhDAL.Update(tt);
        }
        public static void Delete(int iD)
        {
            tbtinhthanhDAL tbtinhthanhDAL = new tbtinhthanhDAL();
            tbtinhthanhDAL.Delete(iD);
        }
        public static tbtinhthanhDTOColection GET(string Where, int PageIndex, int PageSize,
                                        string OrderBy, string OrderDirection,
                                        out int TotalRecords)
        {
            tbtinhthanhDAL tbtinhthanhDAL = new tbtinhthanhDAL();
            return tbtinhthanhDAL.GET(Where, PageIndex, PageSize,
                            OrderBy, OrderDirection, out TotalRecords);
        }
        public static tbtinhthanhDTO GetByID(int iD)
        {
            int t = 0;
            tbtinhthanhDAL tbtinhthanhDAL = new tbtinhthanhDAL();
            tbtinhthanhDTOColection cvcolect = tbtinhthanhDAL.GET("where " + tbtinhthanhDTOColumn.Matinhthanh.ToString() + " = " + iD.ToString(), 0, 0,
                tbtinhthanhDTOColumn.Tentinhthanh.ToString(), "ASC", out t);
            if (cvcolect.Count == 1)
                return cvcolect[0];
            return null;
        }
        public static tbtinhthanhDTOColection GETAll()
        {
            int t = 0;
            tbtinhthanhDAL tbtinhthanhDAL = new tbtinhthanhDAL();
            return tbtinhthanhDAL.GET("where 1=1", 0, 10, tbtinhthanhDTOColumn.Tentinhthanh.ToString(), "ASC", out t);
        }
        public static tbtinhthanhDTOColection gettinhthanh(int id)
        {
            int t = 0;
            tbtinhthanhDAL tbtinhthanhDAL = new tbtinhthanhDAL();
            return tbtinhthanhDAL.GET("where " + tbtinhthanhDTOColumn.Matinhthanh.ToString() + " = " + id.ToString(), 0, 0,
            tbtinhthanhDTOColumn.Tentinhthanh.ToString(), "ASC", out t);
        }
    }
}
